// handle GET method
let http = require("http");
let url = require("url");
let util = require("util");
let port = 9999;

function start(){
    let server = http.createServer(onRequest);
    server.listen(port);
    console.log("Server running %s : %s", server.address().address, server.address().port);

    function onRequest(req, res){
        let query = url.parse(req.url, true);
        res.writeHead(200, {"Content-Type" : "text/html"});
        res.write(util.inspect(query));
        res.end();

        console.log("Request for %s recieved.");
    }
}

exports.start = start;